package com.shop.cereshop.business.dl.logic.controller;

import com.shop.cereshop.business.dl.logic.domian.Address;
import com.shop.cereshop.business.dl.logic.domian.Result;
import com.shop.cereshop.business.dl.logic.domian.VisitPerson;
import com.shop.cereshop.business.dl.logic.service.SendPostImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * @description
 * @Author YF
 * @Date 日期:2021/5/20 时间:14:10
 */
@Controller
@RequestMapping("/vx")
@CrossOrigin
public class DlRequestZxkController {

    @Autowired
    private SendPostImpl sendPost;

    /**
     *
     * @description:商户产品拉取接口
     * @param
     * @return:
     *
     * @author:作者:YF
     * @time:日期:2021/5/20  时间:15:32
     */
    @GetMapping("/getProductInfo")
    @ResponseBody
    public String getProductInfo(String productNo,String sceneryNo,String productType){

        return sendPost.GetProductInfo(1,10,productNo,sceneryNo,productType);


    }

    /**
     * 功能描述: 退单结果通知接口
     * @Param: [request]
     * @return: com.shop.cereshop.app.dl.logic.domian.Result
     * @Author: 况鑫威
     * @Date: 2021/8/2
     * @Time: 14:56
     */
    @PostMapping(value = "/Chargeback",produces = "application/json; charset=utf-8")
    @ResponseBody
    public Result ZXKChargeback(@RequestBody String request) throws Exception {
        System.out.println(request);
        return sendPost.ZXKChargeback(request);
    }



    /**
     *
     * @description:调用产品价格日历
     * @param
     * @return:
     *
     * @author:作者:YF
     * @time:日期:2021/5/20  时间:15:32
     */
    @GetMapping("/getCalenderPrice")
    @ResponseBody
    public String getCalenderPrice(){
        return sendPost.GetCalenderPrice(1000235347,"1621911228839","1621911253747");
    }


    /**
     *
     * @description:订单接口
     * @param
     * @return:
     *
     * @author:作者:YF
     * @time:日期:2021/5/22  时间:14:14
     */
    @GetMapping("/createOrder")
    @ResponseBody
    public String createOrder(){

        VisitPerson visitPerson = new VisitPerson();
        visitPerson.setName("张三");
        visitPerson.setMobile("13007961193");
        visitPerson.setIdCard("302631999206271193");
        VisitPerson visitPerson1 = new VisitPerson();
        visitPerson1.setName("李四");
        visitPerson1.setMobile("13007961194");
        visitPerson1.setIdCard("302631999206271194");
        ArrayList<VisitPerson> list = new ArrayList<>();
        list.add(visitPerson);
        list.add(visitPerson1);

        Address address = new Address();
        address.setName("李先生");
        address.setMobile("13007961194");
        address.setAddress("南昌");
        return sendPost.CreateOrder("sz571717851651807350","1000235347",1,2,1L,1L,"测试1","15307081132","362332199511041309",
                "2016-04-01","2016-05-05",null,null,list,address);

    }





    /**
     *
     * @description:查询接口（分销商调用此接口查询订单信息）
     * @param
     * @return:
     *
     * @author:作者:YF
     * @time:日期:2021/5/22  时间:15:11
     */
    @GetMapping("/queryOrder")
    @ResponseBody
    public String queryOrder(){
        return sendPost.QueryOrder("sz571717851651807350","1000858493");
    }




    /**
     *
     * @description:退单接口（平台提供）
     * @param
     * @return:
     *
     * @author:作者:YF
     * @time:日期:2021/5/22  时间:15:23
     */
    @GetMapping("/cancelOrder")
    @ResponseBody
    public String cancelOrder(String a,String b){
//         return sendPost.CancelOrder("sz571717851651807350","1000858493","行程取消",2);
        return sendPost.CancelOrder(a,b,"行程取消",1);
    }


    /**
     * @description:订单核销接口（平台提供）
     * @param
     * @return:
     * @author:作者:YF
     * @time:日期:2021/5/22  时间:16:40
     */
    @GetMapping("/checkTicket")
    @ResponseBody
    public String checkTicket(){
        return sendPost.CheckTicket("405691132073",1);
    }








}
